package spaceInvaders.view;

import java.awt.Color;
import java.awt.Graphics2D;

import gameFramework.model.entites.Entity;
import gameFramework.view.GEntity;

/**
 * 
 * @author Zhai Jing
 *
 */
public class GMissil extends GEntity {

	public GMissil(Entity arg0) {
		super(arg0);
	}

	/**
	 * @see gameFramework.view.GEntity#draw(java.awt.Graphics2D)
	 */
	@Override
	public void draw(Graphics2D g2d) {
		g2d.setColor(Color.YELLOW);
		int[] xPoints = new int[3];
		int[] yPoints = new int[3];
		
		int x = this.model.getPosition().x;
		int y = this.model.getPosition().y;
		int h = this.model.getSize().height;
		int w = this.model.getSize().width;
		
		xPoints[0] = x;
		yPoints[0] = y + h;
		xPoints[1] = x + w/2;
		yPoints[1] = y;
		xPoints[2] = x + w;
		yPoints[2] = y + h;
		
		g2d.fillPolygon(xPoints, yPoints, 3);
	}

}
